from application import db
from common.models.user import User
from common.models.study_list import StudyList

class StudyOrder(db.Model):
    __tablename__ = 'study_order'

    id = db.Column(db.Integer, primary_key=True)
    sid = db.Column(db.Integer,db.ForeignKey('study_list.id'))
    uid = db.Column(db.Integer,db.ForeignKey('user.id'))
    mark = db.Column(db.Integer)
    updated_time = db.Column(db.DateTime)
    created_time = db.Column(db.DateTime)

    creater = db.relationship('User', foreign_keys=uid)
    studycourse = db.relationship('StudyList',foreign_keys=sid)

# class StudyOrder(db.Model):
#     __tablename__ = 'study_order'
#
#     id = db.Column(db.Integer, primary_key=True)
#     sid = db.Column(db.Integer)
#     uid = db.Column(db.Integer)
#     mark = db.Column(db.Integer)
#     updated_time = db.Column(db.DateTime)
#     created_time = db.Column(db.DateTime)


